<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html>
<%@include file="./common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>有而就是有范儿</title>
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
</head>

<body>
<div class="outer-wrapper noimgbg">
	<!--Top navigator -->
	<%@ include  file="./common/header.jsp"%>
	<!--top navigator end -->
    <!--content -->
    <div class="content-n clear" id="cardListId">
		
    </div><!--content-n end -->
        <!--footer -->
   <%@ include  file="./common/footer.jsp"%>
    <!--footer end -->
</div>
<!-- Snake Change 20141209 -->
<div class="mailBG"></div>
<div class="mailContent">
	<div style="height: 40px;line-height: 40px;background-color: #f15a24;text-align: center;color: white;font-size: 16px;">
		发送邮件
		<div style="cursor: pointer;position: absolute;left: 480px;top: 11px;">
			<img src="image/mailClose.png" alt="close" title="关闭" class="mailClose" />
		</div>
	</div>
	<div style="height: 200px;margin-top: 25px;">
		<div style="float: left;font-size: 16px;margin: 0 20px;">内容</div><textarea id="mailContentCollId" style="width: 400px;height: 200px;border-color: #b2b2b2" rows="0" cols="0"></textarea>
	</div>
	<div style="margin: 0 auto;width: 165px;margin-top: 20px;">
		<div style="width: 180px;height: 35px;line-height: 35px;text-align: center;background-color: #f15a24;color: white;font-size: 16px;cursor: pointer;" onclick="sendMailByColl();">
			发送
		</div>
	</div>
</div>
<!-- Snake Change 20141209 -->
</body>
<script>
/*function request(paras){ 
    var url = location.href; 
    var paraString = url.substring(url.indexOf("?")+1,url.length).split("&"); 
    var paraObj = {} 
    for (i=0; j=paraString[i]; i++){ 
        paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length); 
    } 

    var returnValue = paraObj[paras.toLowerCase()]; 
    if(typeof(returnValue)=="undefined"){ 
        return ""; 
    }else{ 
        return returnValue; 
    } 
}
var value=request('type');*/
var pageIndex=0;
var hasColl=false;
$(function() { 
	if(!checkLogin()){
		return;
	}
		meFavoed(pageIndex);
	
	
});

var collCardId=0;

function setCardCollId(cardId) {
	collCardId=cardId;
}
function sendMailByColl() {
	var cardId = collCardId;
	var title="来自youoor的邮件";
	var contentDiv = $("#mailContentCollId");
	var content =contentDiv.val();
	if(content==null||content=="") {
		alert("发送内容不能为空");return;
	}
	sendMailByYouoor(cardId,title,content);
	$('.mailBG').fadeOut(800);
	$('.mailContent').fadeOut(800);
	contentDiv.val("");
}
function loadRecommendList(){
	objp= {}
	objp.type = 0
	objp.cardId = -1
	objp.num = 10
	   $.ajax({
			  url: '${path}/core/getRecommendList',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
			  success:function(msg){
				  formatCardDataList(msg.infoList);
			   },
			   failure:function(msg){
				   alert(eval('('+msg.responseText+')').error_text);
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}


function formatCardDataList(cardList) {
	var cardDiv = $("#cardListId");
	if(cardList) {
		if(cardList.length>0) {
			hasColl=true;
			cardDiv.empty();
			for (var k=0;k<cardList.length;k++) {
				var linkDiv = formatLinkData(cardList[k].links);
				var randomId=generateMixed(10);
		    	cardDiv.append("<div class=\"content-list\">"+
		    			           "<div class=\"user-img fl\" >"+
		    			               "<img class=\"divImg2\"  onclick=\"toViewCard("+cardList[k].userCard.cardId+")\"  src=\""+imgDomain+cardList[k].userCard.background+"\"   onerror=this.style.display=\"none\" \"/>"+
		    			           "</div>"+
		    			           "<div class=\"content-userinfo content_userinfo_s fl\">"+
		    	                        "<h2 class=\"userinfo-title\">"+cardList[k].userCard.name+"</h2>"+
		    	                        "<ul class=\"userinfo-share  userinfo-share-s\">"+
		    	                           linkDiv+
		    	                        "</ul>"+
		    	                        "<p class=\" user-remark user-remark-n mt5 even\">"+cardList[k].userCard.description+"</p>"+
		    	                        "<ul class=\"location lo2\">"+
		    	    	            	  "<li><a href=\"javascript:void(0);\" class=\"up\">"+cardList[k].userCard.location+"</a></li>"+
		    	    	                  "<li><a href=\"javascript:void(0);\" class=\"mid\">"+cardList[k].userCard.occupation+"</a></li>"+
		    	    	                  "<li><a href=\"javascript:void(0);\" class=\"down\">"+cardList[k].userCard.hobby+"</a></li>"+
		    	    	                "</ul>"+
		    	                        "<ul class=\"widget clear\">"+
		    	                           "<li id=\""+randomId+"\"  class=\"share-op-li share-op-li-s share-op-li-c"+cardList[k].userCard.styleInt+" \" onMouseOver='onMouseOverShare(\""+randomId+"\",\""+cardList[k].userCard.cardId+"\",\""+cardList[k].userCard.background+"\");' onMouseOut='onMouseOutShare(\""+randomId+"\");'>"+
		    	                               "<a href=\"javascript:void(0);\" class=\"share-op share-op"+cardList[k].userCard.styleInt+"\">2</a>"+
		        	                           "<div class=\"bg-long bg-lt bg-long-c"+cardList[k].userCard.styleInt+"\"  style=\"display:none;\">"+
		        	                              "<p>分享到：</p>"+
		        	                              "<ul class=\"share-pop-in\">"+
								                    "<li><a href=\"javascript:void(0);\" class=\"pop-sina\" onclick=\"javascript:bShare.share(event,'sinaminiblog',0);\">新浪网</a></li>"+
						                            "<li><a href=\"javascript:void(0);\" class=\"pop-tengxun\" onclick=\"javascript:bShare.share(event,'qqmb',0);\">腾讯</a></li>"+
						                            "<li><a href=\"javascript:void(0);\" class=\"pop-happy\" onclick=\"javascript:bShare.share(event,'kaixin001',0);\" >开心网</a></li>"+
						                            "<li><a href=\"javascript:void(0);\" class=\"pop-douban\" onclick=\"javascript:bShare.share(event,'douban',0);\">豆瓣</a></li>"+
		        	                                 "</ul>"+
		        	                            "</div>"+
		        	                        "</li>"+
		        	                        " <li class=\"share-op-li share-op-li-s share-op-li-c"+cardList[k].userCard.styleInt+"\"><a href=\"javascript:cancelFavoCard("+cardList[k].userCard.cardId+")\" class=\"delet delete"+cardList[k].userCard.styleInt+"\">11</a></li>"+       
		        	                        " <li class=\"share-op-li share-op-li-s share-op-li-c"+cardList[k].userCard.styleInt+"\"><a href=\"javascript:hi("+cardList[k].userCard.cardId+")\" class=\"say-hi say-hi"+cardList[k].userCard.styleInt+"\">11</a></li>"+       
		        	                        " <li class=\"share-op-li share-op-li-s share-op-li-c"+cardList[k].userCard.styleInt+"\"><a href=\"javascript:setCardCollId("+cardList[k].userCard.cardId+")\" class=\"send-msg send-msg"+cardList[k].userCard.styleInt+" mail\">11</a></li>"+       
	                                    "</ul>"+
	                                "</div>"+
	                             "</div>");
			}
			cardDiv.append("<div style=\"text-align: center;padding-top: 20px;\">"+
					"<a href=\"javascript:previewPage();\" title=\"上一页\"><img style=\"vertical-align: text-top;\" src=\"image/icon_prev.png\" alt=\"\" />上一页</a>"+
					"&nbsp;&nbsp;&nbsp;&nbsp;"+
					"<a href=\"javascript:nextPage();\" title=\"下一页\">下一页<img style=\"vertical-align: text-top;\" src=\"image/icon_next.png\" alt=\"\" /></a>"+
				"</div>");
		}else {
			hasColl =false;
			pageIndex =pageIndex-1;
			/*if(pageIndex==0||pageIndex==-1) {
				cardDiv.empty();
				cardDiv.css("background","url(image/nocoll.png) no-repeat");  
				//cardDiv.append("<img src=\"image/nocoll.png\" style=\" clear:both;display: block;width: 100%;\"/>");
			}*/
		}
		
	}
		
	
}
/**
 * 上一页
 */
function previewPage() {
	if (pageIndex==0) {
		alert("到头了");return;
	}
	pageIndex = pageIndex-1;
	meFavoed(pageIndex);
}

/**
 * 下一页
 */
function nextPage() {
	if(hasColl) {
		pageIndex=pageIndex+1
		meFavoed(pageIndex);
	}else {
		alert("到头了");
	}
}


/**
 * 我的收藏的
 */
function meFavoed(pageIndex) {
	objp= {}
	objp.pageIndex = pageIndex;
	objp.num = 4
	   $.ajax({
			  url: '${path}/core/getFavoList',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
			  success:function(msg){
				  formatCardDataList(msg.infoList);
			   },
			   failure:function(msg){
				   alert(eval('('+msg.responseText+')').error_text);
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}
</script>
<script type="text/javascript" src="js/js.js"></script>
</html>